# -*- coding: utf-8 -*-
from django import template

register = template.Library()

@register.filter(name='columnselect')
def columnselect(value, arg):
    column = int(arg)
    res = []
    tmp = []
    index = 0;
    for obj in value:
        tmp+=[obj]
        index+=1
        if (index>=column):
            res +=[tmp]
            tmp = []
    if len(tmp)>0:
        res+=[tmp]
    return res
